package elasticsearchx

import (
	"fmt"

	"nosqlx/config"

	"github.com/bytedance/sonic"
	"github.com/elastic/go-elasticsearch/v9"
)

func CreatClient() *elasticsearch.Client {
	marshal, err := sonic.Marshal(config.Es)
	if err != nil {
		panic(err)
	}
	fmt.Println(string(marshal))
	c := config.Es.Option()
	client, err := elasticsearch.NewClient(c)
	if err != nil {
		panic("NewClient:" + err.Error())
	}
	return client
}
